package xixirupan.tmgp.tencent.com.vmeim.ui.shopcar.presenter;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;

import java.util.List;

import xixirupan.tmgp.tencent.com.vmeim.ui.beautyshop.model.ShopMainDataBiz;
import xixirupan.tmgp.tencent.com.vmeim.ui.shopcar.model.IShopCarData;
import xixirupan.tmgp.tencent.com.vmeim.ui.shopcar.model.RecommendProductsBaen;
import xixirupan.tmgp.tencent.com.vmeim.ui.shopcar.model.ShopCarBiz;

/**
 * Created by lenovo on 2016/10/20.
 */

public class ShopCarPresenter {
    ShopcarRecyAdapter adapter ;
    ShopCarBiz biz =new ShopCarBiz();
    Context context;
    LayoutInflater inflater;
    RecyclerView recyclerView;
    public  ShopCarPresenter(Context context, LayoutInflater inflater, RecyclerView recyclerView)
    {

        this.recyclerView =recyclerView;
        this.inflater =inflater;
        this.context =context;
    }
    public  void getShopCarData()
    {
        biz.getShopcarData(new IShopCarData() {
            @Override
            public void postShopCarData(List<RecommendProductsBaen> _lists) {
                adapter =new ShopcarRecyAdapter(_lists,inflater,context);
                GridLayoutManager manager =new GridLayoutManager(context,1, LinearLayoutManager.HORIZONTAL,false);
                recyclerView.setLayoutManager(manager);
                recyclerView.setAdapter(adapter);

            }
        });
    }
}
